package com.ruoyi.system.V2.goodInfo.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.ruoyi.system.V2.goodInfo.domain.ExportJYMGoods;
import com.ruoyi.system.model.domain.GoodsInfo;
import com.ruoyi.system.model.dto.GoodReq;
import com.ruoyi.system.model.dto.GoodsInfoAndAttrValueDto;
import com.ruoyi.system.model.dto.GoodsInfoAndAttrValueReq;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * goodsMapper接口
 *
 * @author ruoyi
 * @date 2023-04-06
 */
public interface GoodsInfoMapper {
    /**
     * 查询goods
     *
     * @param id goods主键
     * @return goods
     */
    public GoodsInfo selectGoodsInfoById(Long id);

    public GoodsInfoAndAttrValueDto selectGoodsInfoAndAttrValueById(Long id);

    public List<GoodsInfoAndAttrValueDto> selectGoodsInfoAndAttrValueByIds(@Param("ids") List<Long> ids);

    /**
     * 查询goods列表
     *
     * @param goodsInfo goods
     * @return goods集合
     */
    public List<GoodsInfo> selectGoodsInfoList(GoodsInfo goodsInfo);

    /**
     * 查询goods列表
     *
     * @param goodsInfo goods
     * @return goods集合
     */
    public List<GoodsInfo> selectGoodsInfoList1(GoodsInfo goodsInfo);

    /**
     * 新增goods
     *
     * @param goodsInfo goods
     * @return 结果
     */
    public int insertGoodsInfo(GoodsInfo goodsInfo);

    /**
     * 修改goods
     *
     * @param goodsInfo goods
     * @return 结果
     */
    public int updateGoodsInfo(GoodsInfo goodsInfo);

    /**
     * 删除goods
     *
     * @param goodsInfo goods
     * @return 结果
     */
    public int deleteGoodsInfoById(GoodsInfo goodsInfo);

    /**
     * 批量删除goods
     *
     * @param goodsInfo goods
     * @return 结果
     */
    public int deleteGoodsInfoByIds(GoodsInfo goodsInfo);


    public List<GoodsInfoAndAttrValueDto> selectGoodsInfoAndAttrList(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto);

    List<GoodsInfo> selectByResList(GoodsInfoAndAttrValueReq goodsInfoAndAttrValueReq);

    Integer apiSelectGoodsCountBySupply(GoodsInfo goodsInfo);

    int auditGoods(@Param("ids") Long[] ids);

    int down(@Param("ids") Long[] ids);

    int submitAccount(@Param("ids") Long[] ids);

    List<GoodsInfo> selectPush(GoodReq goodReq);
    List<GoodsInfo> selectPush2(GoodReq goodReq);
    List<GoodsInfo> selectPushsjzpx(GoodReq goodReq);
    List<GoodsInfo> selectPush3(GoodReq goodReq);
    List<GoodsInfo> selectPushsjzhpx(GoodReq goodReq);

    List<Long> accIds(GoodsInfo goodsInfo);

    GoodsInfo selectGoodsInfoByCorrespondjym(String correspondjym);

    GoodsInfo selectGoodsInfoByThirdId(String thirdId);

    List<Map<String, Object>> countForSupply(Long userId);

    List<Map<String, Object>> userGameCount();

    Map<String, Object> statistics(GoodsInfo goodsInfo);

    void updateGoodsInfoJymUid(GoodsInfo info);

    List<Map<String, Object>> goodsCount(GoodsInfo goodsInfo);

    List<Map<String, Object>> hotGame(GoodsInfo goodsInfo);

    int selectDayCount();

    void transferThePossessionOf(@Param("transferId") Long transferId, @Param("transferId") Long userId);

    void updateRisePrice(Long gameId, BigDecimal price);

    int updateMonitoringIssues(@Param("ids") List<Long> ids, @Param("monitoringIssues") String monitoringIssues);
    int updateMonitoringState(@Param("ids") List<Long> ids, @Param("monitoringState") String monitoringState);

    @InterceptorIgnore(tenantLine = "1")
    @Update("update goods_info " +
            "set monitoring_state = #{monitoringState}," +
            "monitoring_issues = #{monitoringIssues} " +
            "where id = #{goodsId}")
    int updateMonitoringSome(@Param("goodsId") Long goodsId,
                             @Param("monitoringState") String monitoringState,
                             @Param("monitoringIssues") String monitoringIssues);


    List<Map<String,Object>> selectGoodsAccountAndType(@Param("ids")  List<Long> ids);

    List<ExportJYMGoods> selectExportJYM(GoodsInfo goodsInfo);

    /**
     * 根据手机号id 获取商品绑定统计
     * @param goodsInfo
     * @return
     */
    List<Map<String, Object>> selectGoodsGameTotal(GoodsInfo goodsInfo);
}
